import { http } from "/@/utils/http/request";
import { BasicResponseModel } from "/@/types/http";
import { MenuVo } from "/@/api/system/menu/types"

/**
 * @description: 根据用户id获取用户菜单
 */
export function adminMenus() {
  return http.request<BasicResponseModel<MenuVo[]>>({
    url: "/menus",
    method: "GET",
  });
}

/**
 * @description: 获取所有权限菜单
 */
export function getMenuTree() {
  return http.request<BasicResponseModel<MenuVo[]>>({
    url: "/menu/tree",
    method: "GET",
  });
}

/**
 * @description: 添加权限菜单信息
 */
export function addPermissionInfo(params: any) {
  return http.request<BasicResponseModel>({
    url: "/menu/add",
    method: "post",
    data: params,
  });
}

/**
 * @description: 更新权限菜单信息
 */
export function updatePermissionInfo(params: any) {
  return http.request<BasicResponseModel>({
    url: "/menu/update",
    method: "post",
    data: params,
  });
}

/**
 * @description: 删除权限菜单信息
 */
export function deletePermissionInfo(menuId: any) {
  return http.request<BasicResponseModel>({
    url: `/menu/delete`,
    method: "post",
    params: { menuId: menuId },
  });
}


export default {
  adminMenus,
  getMenuTree,
  addPermissionInfo,
  updatePermissionInfo,
  deletePermissionInfo,
};
